<?php
    $this->Html->css('controllers/TransportRequests/request.css?5', array('block' => 'stylesTop'));
    $this->Html->script('controllers/TransportRequests/request.js?3', array('block' => 'scriptBottom'));
?>

<div class="print-button hidden-print">
    <span class="k-button k-primary"><?php echo __('Imprimir Solicitud'); ?></span>
</div>

<table class="table-bordered">
    <thead>
        <tr>
            <th colspan="6"><?php echo __('ROBERT BOSCH SISTEMAS AUTOMOTRICES S.A. DE C.V.'); ?></th>
        </tr>
        <tr>
            <th colspan="6"><?php echo __('Solicitud de transporte'); ?></th>
        </tr>
        <tr>
            <th colspan="1"><?php echo __('Fecha: '); ?> <span id="dateRequest" data-date='<?php echo $appBosch->request['cDate']; ?>'></span></th>
            <th colspan="4" rowspan="2"><?php echo __('Motivo por el que se requiere el servicio: Curso ') . $appBosch->request['motive']; ?></th>
            <th colspan="1" rowspan="2"><?php echo __('Solicitante: ') . $appBosch->request['user']; ?></th>
        </tr>
        <tr>
            <th colspan="1"><?php echo __('Lugar: ') . $appBosch->request['place']; ?></th>
        </tr>
        <tr>
            <th><?php echo __('NOMBRE: '); ?></th>
            <th><?php echo __('LINEA: '); ?></th>
            <th><?php echo __('CALLE: '); ?></th>
            <th><?php echo __('NUM: '); ?></th>
            <th><?php echo __('COLONIA: '); ?></th>
            <th><?php echo __('ENTRE QUE CALLES: '); ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($appBosch->users as $user) { ?>
            <tr>
                <td><?php echo $user['user']; ?></td>
                <td><?php echo $user['line']; ?></td>
                <td><?php echo $user['street']; ?></td>
                <td><?php echo $user['number']; ?></td>
                <td><?php echo $user['colony']; ?></td>
                <td><?php echo $user['btwStreets']; ?></td>
            </tr>
        <?php } ?>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="1" rowspan="2"><?php echo __('Horario en que se el quiere el servicio'); ?></td>
            <?php
                if ( $appBosch->request['type'] == '1' ) {
                    $typeService = __('Entrada');
                    $hour = strtotime ( '-30 minute' , strtotime ( $appBosch->request['sDate'] ) ) ;
                    $hour = date ( 'H:i' , $hour );
                } elseif ( $appBosch->request['type'] == '2' ) {
                    $typeService = __('Salida');
                    $hour = strtotime ( '+10 minute' , strtotime ( $appBosch->request['eDate'] ) ) ;
                    $hour = date ( 'H:i' , $hour );
                } else {
                    $typeService = "Indefinido";
                    $hour = '00:00';
                }
            ?>
            <td rowspan="2" class="hourCell"><?php echo $hour; ?></td>
            <td colspan="2" rowspan="2" class="hourCell"><?php echo $typeService; ?></td>
            <td><?php echo __('Fecha en la que se requiere el servicio'); ?></td>
            <td id="dateService" data-date='<?php echo $appBosch->request['sDate']; ?>'></td>
        </tr>
        <tr>
            <td><?php echo __('No. de personas que requieren el servicio'); ?></td>
            <td><?php echo $appBosch->request['cant']; ?></td>
        </tr>
        <tr>
            <td class="leftAling" colspan="7"><?php echo __('Observaciones: '); ?></td>
        </tr>
    </tfoot>
</table>
<div id="signatures">
    <div><?php echo __('Firmas de autorización'); ?></div>
    <div id="subNames">
        <div id="signPetitioner">
            <div class="ingSign"></div>
            <p>Nombre</p>
            <p><?php echo __('Solicitante'); ?></p>
        </div>
        <div id="signAM">
            <div class="ingSign"></div>
            <p>Nombre</p>
            <p><?php echo __('Gerente de área'); ?></p>
        </div>
        <div id="signRH">
            <div class="ingSign"></div>
            <p>Nombre</p>
            <p><?php echo __('Recursos Humanos'); ?></p>
        </div>
    </div>
</div>

<div class="print-button hidden-print">
    <span class="k-button k-primary"><?php echo __('Imprimir Solicitud'); ?></span>
</div>